

*Author: Joonas Tuhkuri
*Updated: March 5 2024
*Description: This do file creates xwalks


*Preliminaries
	clear all
	global project_root "W:\Ramin\Stereotypes revision"

*Prepare person id crosswalk
	use "W:\input2018\Tk_tutnro_crosswalk\Tk_tutnro_crosswalk.dta"
	rename Tk_tutnro_uusi id
	rename uusi_tutnro shnro 
	keep id shnro
	save "${project_root}\data_prep\xwalk_id_shnro.dta", replace
	
*Firm / Establishment - Link between persons and firms by year (from FOLK_jaksot, firm identifier not in the main data) 
	use "D:\ready-made\FOLK_jaksot_a\tyosuhde_1.dta"
	append using "D:\ready-made\FOLK_jaksot_a\tyosuhde_2.dta" 
	keep if atv == 1
	keep shnro vuosi sykstun
	drop if sykstun == ""
	save "${project_root}\data_prep\link_year_person_year_atv.dta", replace

*Industry
	import delimited "${project_root}\data_input\xwalk_industry_3digit.csv", encoding(UTF-8) clear 
	save "${project_root}\data_prep\xwalk_industry_3digit.dta", replace